{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import scipp as sc\n",
    "from scipp.scipy.signal import butter, sosfiltfilt\n",
    "x = sc.linspace(dim='x', start=1.1, stop=4.0, num=1000, unit='m')\n",
    "y = sc.sin(x * sc.scalar(1.0, unit='rad/m'))\n",
    "y += sc.sin(x * sc.scalar(400.0, unit='rad/m'))\n",
    "da = sc.DataArray(data=y, coords={'x': x})\n",
    "sos = butter(da.coords['x'], N=4, Wn=20 / x.unit)\n",
    "out = sosfiltfilt(da, 'x', sos=sos)\n",
    "sc.plot({'input':da, 'sosfiltfilt':out})"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
